package rita.ui.component;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;

/**
 * Esta clase se encarga de calcular la posicion central en pantalla, de modo de
 * poder ubicarla centrada
 * 
 * @author Vanessa Aybar Rosales
 * */
public class PositionCalc {
	public static void centerDialog(Window w) {
		Toolkit tk = Toolkit.getDefaultToolkit();
		Dimension screenSize = tk.getScreenSize();

		int screenHeight = screenSize.height;
		int screenWidth = screenSize.width;
		w.setLocation((int) ((screenWidth / 2) - (w.getSize().getWidth() / 2)),
				(int) ((screenHeight / 2) - (w.getSize().getHeight() / 2)));
	}
}
